import 'package:baselib/utils/image_util.dart';
import 'package:flutter/material.dart';
import 'package:framelib/base/base_view.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/drawable_util.dart';
import 'package:framelib/utils/px_util.dart';
import 'package:framelib/utils/string_util.dart';
import 'package:framelib/widgets/floating_drag_action_button.dart';
import 'package:framelib/widgets/nosize_app_bar.dart';
import 'package:framelib/widgets/page_widget_manager.dart';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:get/get.dart';
import 'package:module_business/comm/viewmodel/splash_view_model.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
/**
 * 启动主页
 */
class SplashPage extends GetWidget<SplashViewModel> {
  @override
  Widget build(BuildContext context) {
    return PageRouteBuild<SplashViewModel>(
        builder: (SplashViewModel model){
          return PageWidgetManager.buildPage(
              context: context,
            backgroundColor: color_white,
            appBar: NoSizeAppBar(
              backgroundColor: color_main_half_2,
              statusColor: color_333333,
            ),
            body: Container(
                decoration: BoxDecoration(
                    gradient: LinearGradient(
                        begin: Alignment.topCenter,
                        end: Alignment.bottomCenter,
                        colors: [
                          color_main_half_2,
                          color_main_half_2,
                          // color_main_half_2,
                          // color_white,
                          // color_main_half_4,
                        ]
                    )
                ),
                width: MediaQuery.sizeOf(context).width,
                height: MediaQuery.sizeOf(context).height,
                alignment: Alignment.center,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Container(
                            margin: EdgeInsets.only(
                                right: px_5.w,
                                bottom: px_5.h
                            ),
                            child: Hero(
                                tag: 'appLogo',
                                child: ImageUtil.loadAssetImage(
                                    drawable_icon_logo,
                                    width: px_100.w,
                                    color: color_main
                                )
                            )
                        ),
                      ],
                    ),
                    Container(
                      margin: EdgeInsets.only(
                          top: px_56.h
                      ),
                      child: DefaultTextStyle(
                          style: TextStyle(
                              fontSize: px_28.sp,
                              color: color_main,
                              letterSpacing: px_21.w
                          ),
                          child: AnimatedTextKit(
                            animatedTexts: [
                              WavyAnimatedText('${string_app_name}~',
                                speed: Duration(milliseconds: 450),
                              ),
                            ],
                            repeatForever: true,
                            isRepeatingAnimation: true,
                            onTap: () {
                              print("Tap Event");
                            },
                          )
                      ),
                    ),
                  ],
                )
            ),
          );
        }
    );
  }
}
